package com.shakespace.template.extensions

import android.util.TypedValue
import android.view.View


fun View.dp2px(dp: Float): Int {
    val px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.resources.displayMetrics)
    return px.toInt()
}

fun View.dpToPx(dp: Float): Int {
    val scale = context.resources.displayMetrics.density
    return (dp * scale + 0.5f).toInt()
}